package com.juc.phaser.phaser14;

import java.util.concurrent.Phaser;

public class ThreadA extends Thread{
    /**
     * awaitAdvanceInterruptibly(10) 当线程执行的栏数不符合指定的参数时
     * 则继续执行下面的代码
     */
	private Phaser phaser;
	
	public ThreadA(Phaser phaser){
		super();
		this.phaser = phaser;
	}
	@Override
	public void run() {
		try {
			System.out.println(Thread.currentThread().getName() + " A1 begin = " +System.currentTimeMillis());
			phaser.awaitAdvanceInterruptibly(10); //不符合栏数就继续执行
			System.out.println(Thread.currentThread().getName() + " A1 end = " +System.currentTimeMillis());
		} catch (InterruptedException e) {
			System.out.println(" 进入catch");
			e.printStackTrace();
		}
	}
}
